package com.pet.seller.controller;

import com.pet.seller.mapper.GoodsMapper;
import com.pet.seller.model.GoodsExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;


@RestController
public class GoodsController {
    @Autowired
    private GoodsMapper goodsMapper;

    @RequestMapping(value="/deletegoods",method = RequestMethod.POST)
    public String deletegoods(HttpServletRequest request, Model model) throws ParseException {
        String id = request.getParameter("id");

        GoodsExample goodsExample = new GoodsExample();

        goodsExample.createCriteria().andIdEqualTo(Integer.parseInt(id));
        goodsMapper.deleteByExample(goodsExample);
        return "OK";
    }

}